<CommentBar>:
    pos_hint: {'top':1}
    size_hint_y: None
    ActionView:
        use_separator: True
        ActionPrevious:
            with_previous: True
            app_icon: 'images/mediagoblin_small.png'
    # TODO figure out a better way to dispatch
            on_release: root.open_previous = not root.open_previous


<CommentModal>:
    comment_layout: comment_layout
    background_color: 0,0,0,1
    background: 'atlas://data/images/defaulttheme/button_disabled'
    BoxLayout:
        spacing: sp(20)
        orientation: 'vertical'
        auto_dismiss: False
        CommentBar:
            on_open_previous: root.dismiss()
        BoxLayout:
            padding: sp(20), sp(0)
            id: comment_box
            orientation: 'vertical'
            BoxLayout:
                size_hint_y: None
                height: comment_box.height - scroll_view.height 

            ScrollView:
                id: scroll_view
                size_hint_y: None
                height: comment_layout.height if comment_layout.height < comment_box.height else comment_box.height
                StackLayout:
                    orientation: 'lr-bt'
                    size_hint_y: None
                    height: self.minimum_height
                    id: comment_layout
                    cols: 1
        AnchorLayout:
            size_hint_y: None
            height: comment_input.height
            anchor_y: 'bottom'
            BoxLayout:
                orientation: 'horizontal'
                TextInput:
                    id: comment_input
                    background_color: [1,1,1,0.15]
                    foreground_color: [1,1,1,1]
                    hint_text_color: [1,1,1,1]
                    cursor_color: [1,1,1,1]
                    size_hint_y: None
                    hint_text: 'comment...'
                    height: self.minimum_height
                    padding_y: sp(15)
                    padding_x: sp(15)
                Button:
                    background_normal: ''
                    background_down: 'atlas://data/images/defaulttheme/button'
                    background_color: utils.get_color_from_hex("#86D4B1")
                    size_hint: None, None
                    height: comment_input.height 
                    width: self.height
                    on_release: root.post_comment(comment_input.text); comment_input.text = ''
                    Image:
                        source: 'images/send_icon.png'
                        size_hint_y: None
                        height: self.parent.height / 2
                        x: self.parent.x + (self.parent.width / 2 - self.width / 2)
                        y: self.parent.y + (self.parent.height / 2 - self.height / 2)


<ActivityDescriptionCell>:
    orientation: 'horizontal'
    padding: [0,10,0,30]
    Label:
        size_hint_x: None
        text: str(root.actor) if root.actor else ''
        text_size: self.size
    Label:
        size_hint_y: None
        text_size: self.width, None
        height: self.texture_size[1]
        text: str(root.description) if root.description else ''


# TODO add profile click functionality and timestamp
<CommentModalCell>
    orientation: 'horizontal'
    size_hint_y: None
    height: comment_label.height
    Label:
        padding_y: sp(10)
        id: comment_label
        text: root.comment_text
        size_hint_y: None
        text_size: self.width, None
        height: self.texture_size[1]
        markup: True
        on_ref_press: root.open_profile_modal()
